package com.elec.controller.end;

import com.elec.domain.R;
import com.elec.domain.entity.ElectricityBill;
import com.elec.service.ElectricityBillService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author yu
 * @date 2024/7/6
 */
@RestController
@RequestMapping("end/electricityBill")
public class BillController {
    @Resource
    private ElectricityBillService electricityBillService;
    @PostMapping
    public R add(@RequestBody ElectricityBill electricityBill){
        return electricityBillService.add(electricityBill);
    }
    @DeleteMapping("{id}")
    public R delete(@PathVariable("id") Long id){
        return electricityBillService.delete(id);
    }
    @GetMapping("{id}")
    public R get(@PathVariable("id") Long id){
        return electricityBillService.get(id);
    }
    @GetMapping("list")
    public R getList(@RequestParam(defaultValue = "1") Integer pageNum,
                     @RequestParam(defaultValue = "10") Integer pageSize,
                     ElectricityBill electricityBill){
        return electricityBillService.getList(pageNum,pageSize,electricityBill);
    }
    @PutMapping
    public R update(@RequestBody ElectricityBill electricityBill){
        return electricityBillService.update(electricityBill);
    }
}
